<template>
  <div class="header-container">
    <div class="l-content">
      <el-image style="height: 50px;margin:0 20px" :src="src"></el-image>
    </div>
    <div class="r-content">
      <el-dropdown @command="handleCommand">
        <span class="el-dropdown-link">
          <el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" ></el-avatar>
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item command="myInfo">个人中心</el-dropdown-item>
          <el-dropdown-item command="loginOut" >退出</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </div>
</template>

<script>
import logo from "../assets/fzu.jpg";
import info from "../assets/info.png";
import Cookie from "js-cookie";
export default {
  data() {
    return {
      url:info,
      src:logo
    };
  },
  created(){
  },
  methods: {
    loginOut() {
      Cookie.remove("token");
      Cookie.remove("menu");
      Cookie.remove("information");
    },
    handleCommand(command) {
      if (command == "loginOut") {
        Cookie.remove("token");
        Cookie.remove("menu");
        this.axios
          .get("api/sys/logout")
          .then((response) => {
            this.$message.success('退出登录');
          })
          .catch((error) => {});
        this.$router.replace("/");
      } else {
        this.$router.push("/");
      }
    },
  },
};
</script>
<style lang="less" scoped>
.header-container {
  font-family: "微软雅黑";
  padding: 0 20px;
  background-color: #ffffff;
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .text {
    color: #ffff;
    font-size: 14px;
    margin-left: 10px;
  }
  .r-content {
    .user {
      width: 40px;
      height: 40px;
      border-radius: 50%;
    }
  }
  .l-content {
    display: flex;
    align-items: center;
    /deep/.el-breadcrumb__item {
      .el-breadcrumb__inner {
        //font-weight: bold;
        &.is-link {
          color: #303133;
        }
      }
      &:last-child {
        .el-breadcrumb__inner {
          color: #97a8be;
        }
      }
    }
  }
}
</style>